// 策略模拟数据
export interface StrategyIndicators {
  buy: {
    dragonfly: {
      enabled: boolean;
      timeframe: string;
      shadowRatio: number;
    };
    rsi: {
      enabled: boolean;
      period: number;
      oversold: number;
      confirm: number;
    };
    volume: {
      enabled: boolean;
      multiplier: number;
      period: number;
    };
    ma: {
      enabled: boolean;
      short: number;
      long: number;
      position: string;
    };
    macd: {
      enabled: boolean;
      fast: number;
      slow: number;
      signal: number;
    };
    bollinger: {
      enabled: boolean;
      period: number;
      stdDev: number;
    };
    stochastic: {
      enabled: boolean;
      period: number;
      smoothK: number;
      smoothD: number;
    };
    ema: {
      enabled: boolean;
      period: number;
      confirmation: boolean;
    };
    atr: {
      enabled: boolean;
      period: number;
      multiplier: number;
    };
    ichimoku: {
      enabled: boolean;
      tenkan: number;
      kijun: number;
      senkou: number;
    };
  };
  sell: {
    takeProfit: {
      enabled: boolean;
      percentage: number;
      trailing: boolean;
      trailDistance: number;
    };
    stopLoss: {
      enabled: boolean;
      percentage: number;
      dynamic: boolean;
      atrMultiplier: number;
    };
    rsi: {
      enabled: boolean;
      period: number;
      overbought: number;
      duration: number;
    };
    gravestone: {
      enabled: boolean;
      timeframe: string;
      shadowRatio: number;
    };
    macd: {
      enabled: boolean;
      divergence: boolean;
      bearishCross: boolean;
    };
    bollinger: {
      enabled: boolean;
      upperBand: boolean;
      squeeze: boolean;
    };
    volumeProfile: {
      enabled: boolean;
      resistance: boolean;
      lowVolume: boolean;
    };
  };
}

export interface RiskConfig {
  maxPosition: number;          // 最大仓位百分比
  maxSingleTrade: number;       // 单笔交易最大仓位
  riskFactor: number;           // 风险系数
  dailyMaxLoss: number;         // 每日最大亏损
  maxConsecutiveLoss: number;   // 最大连续亏损次数
  drawdownAlert: number;        // 回撤警告阈值
  dailyMaxTrades: number;       // 每日最大交易次数
  tradeInterval: number;        // 交易间隔(分钟)
  cooldownPeriod: number;       // 冷却期(分钟)
  kellyRatio: number;           // 凯利公式仓位管理
  sharpeThreshold: number;      // 夏普比率门槛
  correlationLimit: number;     // 相关性限制
}

export interface Strategy {
  id: number;
  name: string;
  type: 'trend' | 'technical' | 'grid' | 'arbitrage' | 'volatility';
  symbol: string;
  status: 'running' | 'paused' | 'stopped' | 'error';
  totalReturn: number;
  dailyReturn: number;
  trades: number;
  winRate: number;
  drawdown: number;
  initialCapital: number;
  currentCapital: number;
  createTime: string;
  updateTime: string;
  riskLevel: 'low' | 'medium' | 'high';
  description: string;
  sharpeRatio: number;
  maxRunup: number;
  avgTradeReturn: number;
  volatility: number;
  indicators: StrategyIndicators;
  riskConfig: RiskConfig;
}

// 模拟策略数据
export const mockStrategies: Strategy[] = [
  {
    id: 1,
    name: 'BTC蜻蜓Dragonfly策略',
    type: 'trend',
    symbol: 'BTC/USDT',
    status: 'running',
    totalReturn: 15.67,
    dailyReturn: 0.45,
    trades: 127,
    winRate: 62.3,
    drawdown: -8.2,
    initialCapital: 100000,
    currentCapital: 115670,
    createTime: '2024-01-15 09:30:00',
    updateTime: '2024-02-20 14:23:15',
    riskLevel: 'medium',
    description: '基于蜻蜓Doji反转信号，结合RSI超卖确认入场，适合4H-1D时间框架的趋势反转交易',
    sharpeRatio: 1.68,
    maxRunup: 22.3,
    avgTradeReturn: 1.34,
    volatility: 12.8,
    indicators: {
      buy: {
        dragonfly: {
          enabled: true,
          timeframe: '4h',
          shadowRatio: 3.5  // 更严格的蜻蜓标准
        },
        rsi: {
          enabled: true,
          period: 14,
          oversold: 25,      // 更极端的超卖区域
          confirm: 32        // 确认反弹
        },
        volume: {
          enabled: true,
          multiplier: 2.0,   // 放量确认
          period: 20
        },
        ma: {
          enabled: true,
          short: 21,         // 黄金分割周期
          long: 55,          // 斐波那契周期
          position: 'price_above_short'
        },
        macd: {
          enabled: true,
          fast: 12,
          slow: 26,
          signal: 9          // MACD背离确认
        },
        bollinger: {
          enabled: true,
          period: 20,
          stdDev: 2.1        // 布林带下轨支撑
        },
        stochastic: {
          enabled: true,
          period: 14,
          smoothK: 3,
          smoothD: 3         // KDJ金叉确认
        },
        ema: {
          enabled: true,
          period: 200,       // 长期趋势确认
          confirmation: true
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 1.5    // 波动率过滤
        },
        ichimoku: {
          enabled: false,
          tenkan: 9,
          kijun: 26,
          senkou: 52
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 6.5,   // 合理止盈
          trailing: true,    // 移动止盈
          trailDistance: 2.0 // 追踪距离
        },
        stopLoss: {
          enabled: true,
          percentage: 3.8,   // 严格止损
          dynamic: true,
          atrMultiplier: 2.0 // ATR动态止损
        },
        rsi: {
          enabled: true,
          period: 14,
          overbought: 75,    // 超买警告
          duration: 2
        },
        gravestone: {
          enabled: true,
          timeframe: '4h',
          shadowRatio: 3.5   // 墓碑十字反转
        },
        macd: {
          enabled: true,
          divergence: true,  // 顶背离
          bearishCross: true // 死叉
        },
        bollinger: {
          enabled: true,
          upperBand: true,   // 上轨压力
          squeeze: false
        },
        volumeProfile: {
          enabled: true,
          resistance: true,  // 成交量阻力
          lowVolume: false
        }
      }
    },
    riskConfig: {
      maxPosition: 70,
      maxSingleTrade: 12,
      riskFactor: 1.0,
      dailyMaxLoss: 2.5,
      maxConsecutiveLoss: 3,
      drawdownAlert: 8,
      dailyMaxTrades: 6,
      tradeInterval: 45,
      cooldownPeriod: 90,
      kellyRatio: 0.25,
      sharpeThreshold: 1.5,
      correlationLimit: 0.7
    }
  },
  {
    id: 2,
    name: 'ETH MACD黄金交叉策略',
    type: 'technical',
    symbol: 'ETH/USDT',
    status: 'running',
    totalReturn: 23.45,
    dailyReturn: 0.78,
    trades: 89,
    winRate: 68.5,
    drawdown: -12.1,
    initialCapital: 50000,
    currentCapital: 61725,
    createTime: '2024-01-20 11:15:00',
    updateTime: '2024-02-20 16:45:30',
    riskLevel: 'medium',
    description: 'MACD黄金交叉配合布林带下轨支撑，捕捉ETH中期趋势机会',
    sharpeRatio: 1.89,
    maxRunup: 28.7,
    avgTradeReturn: 2.1,
    volatility: 15.3,
    indicators: {
      buy: {
        dragonfly: {
          enabled: false,
          timeframe: '1h',
          shadowRatio: 2.5
        },
        rsi: {
          enabled: true,
          period: 14,
          oversold: 30,
          confirm: 38       // RSI确认反弹
        },
        volume: {
          enabled: true,
          multiplier: 1.8,  // 温和放量
          period: 20
        },
        ma: {
          enabled: true,
          short: 12,
          long: 26,
          position: 'golden_cross' // 均线黄金交叉
        },
        macd: {
          enabled: true,
          fast: 12,
          slow: 26,
          signal: 9         // MACD金叉必须
        },
        bollinger: {
          enabled: true,
          period: 20,
          stdDev: 2.0       // 布林带下轨买入
        },
        stochastic: {
          enabled: true,
          period: 14,
          smoothK: 3,
          smoothD: 3        // KDJ低位金叉
        },
        ema: {
          enabled: true,
          period: 50,       // 中期趋势
          confirmation: true
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 1.2   // 波动率适中
        },
        ichimoku: {
          enabled: true,
          tenkan: 9,
          kijun: 26,
          senkou: 52        // 一目均衡表确认
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 8.5,  // 技术分析策略较高止盈
          trailing: true,
          trailDistance: 2.5
        },
        stopLoss: {
          enabled: true,
          percentage: 4.2,
          dynamic: true,
          atrMultiplier: 2.2
        },
        rsi: {
          enabled: true,
          period: 14,
          overbought: 70,
          duration: 2
        },
        gravestone: {
          enabled: false,
          timeframe: '1h',
          shadowRatio: 2.5
        },
        macd: {
          enabled: true,
          divergence: true,  // 重要：MACD顶背离
          bearishCross: true // MACD死叉
        },
        bollinger: {
          enabled: true,
          upperBand: true,   // 布林带上轨阻力
          squeeze: true      // 布林带收缩
        },
        volumeProfile: {
          enabled: true,
          resistance: true,
          lowVolume: true    // 量能萎缩
        }
      }
    },
    riskConfig: {
      maxPosition: 75,
      maxSingleTrade: 18,
      riskFactor: 1.2,
      dailyMaxLoss: 4.0,
      maxConsecutiveLoss: 3,
      drawdownAlert: 12,
      dailyMaxTrades: 10,
      tradeInterval: 30,
      cooldownPeriod: 60,
      kellyRatio: 0.3,
      sharpeThreshold: 1.6,
      correlationLimit: 0.65
    }
  },
  {
    id: 3,
    name: 'SOL网格交易策略',
    type: 'grid',
    symbol: 'SOL/USDT',
    status: 'running',
    totalReturn: 18.92,
    dailyReturn: 0.52,
    trades: 234,
    winRate: 78.2,
    drawdown: -6.8,
    initialCapital: 30000,
    currentCapital: 35676,
    createTime: '2024-02-01 08:45:00',
    updateTime: '2024-02-20 18:12:45',
    riskLevel: 'low',
    description: '智能网格交易，在SOL震荡区间内高抛低吸，适合横盘市场',
    sharpeRatio: 2.14,
    maxRunup: 21.5,
    avgTradeReturn: 0.8,
    volatility: 8.9,
    indicators: {
      buy: {
        dragonfly: {
          enabled: false,
          timeframe: '1h',
          shadowRatio: 2.5
        },
        rsi: {
          enabled: true,
          period: 14,
          oversold: 35,     // 网格策略较温和的RSI
          confirm: 42
        },
        volume: {
          enabled: false,   // 网格不依赖成交量
          multiplier: 1.0,
          period: 10
        },
        ma: {
          enabled: true,
          short: 20,        // 均线判断区间中轴
          long: 50,
          position: 'range_bound' // 震荡区间
        },
        macd: {
          enabled: false,
          fast: 12,
          slow: 26,
          signal: 9
        },
        bollinger: {
          enabled: true,
          period: 20,
          stdDev: 1.8       // 布林带下轨网格买入
        },
        stochastic: {
          enabled: true,
          period: 14,
          smoothK: 3,
          smoothD: 3        // KDJ超卖区域
        },
        ema: {
          enabled: false,
          period: 200,
          confirmation: false
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 0.8   // 低波动率环境
        },
        ichimoku: {
          enabled: false,
          tenkan: 9,
          kijun: 26,
          senkou: 52
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 2.8,  // 网格小幅止盈
          trailing: false,  // 固定止盈
          trailDistance: 0
        },
        stopLoss: {
          enabled: true,
          percentage: 1.8,  // 紧密止损
          dynamic: false,
          atrMultiplier: 1.0
        },
        rsi: {
          enabled: true,
          period: 14,
          overbought: 65,   // 网格较早获利了结
          duration: 1
        },
        gravestone: {
          enabled: false,
          timeframe: '1h',
          shadowRatio: 2.5
        },
        macd: {
          enabled: false,
          divergence: false,
          bearishCross: false
        },
        bollinger: {
          enabled: true,
          upperBand: true,  // 布林带上轨卖出
          squeeze: false
        },
        volumeProfile: {
          enabled: false,
          resistance: false,
          lowVolume: false
        }
      }
    },
    riskConfig: {
      maxPosition: 90,      // 网格可高仓位
      maxSingleTrade: 5,    // 但单笔小仓位
      riskFactor: 0.6,      // 低风险系数
      dailyMaxLoss: 1.5,
      maxConsecutiveLoss: 8, // 允许更多连续亏损
      drawdownAlert: 6,
      dailyMaxTrades: 40,   // 高频交易
      tradeInterval: 3,     // 短间隔
      cooldownPeriod: 5,
      kellyRatio: 0.15,     // 保守的凯利公式
      sharpeThreshold: 2.0,
      correlationLimit: 0.8
    }
  },
  {
    id: 4,
    name: 'BNB套利Alpha策略',
    type: 'arbitrage',
    symbol: 'BNB/USDT',
    status: 'paused',
    totalReturn: 11.34,
    dailyReturn: 0.31,
    trades: 156,
    winRate: 71.8,
    drawdown: -4.2,
    initialCapital: 80000,
    currentCapital: 89072,
    createTime: '2024-01-25 14:20:00',
    updateTime: '2024-02-19 10:30:22',
    riskLevel: 'low',
    description: '跨交易所套利策略，捕捉BNB在不同平台间的价格差异',
    sharpeRatio: 1.92,
    maxRunup: 15.6,
    avgTradeReturn: 0.73,
    volatility: 6.2,
    indicators: {
      buy: {
        dragonfly: {
          enabled: false,
          timeframe: '1h',
          shadowRatio: 2.5
        },
        rsi: {
          enabled: false,   // 套利不依赖技术指标
          period: 14,
          oversold: 30,
          confirm: 35
        },
        volume: {
          enabled: true,
          multiplier: 5.0,  // 高流动性要求
          period: 5         // 短周期
        },
        ma: {
          enabled: false,
          short: 5,
          long: 10,
          position: 'both'
        },
        macd: {
          enabled: false,
          fast: 12,
          slow: 26,
          signal: 9
        },
        bollinger: {
          enabled: false,
          period: 20,
          stdDev: 2
        },
        stochastic: {
          enabled: false,
          period: 14,
          smoothK: 3,
          smoothD: 3
        },
        ema: {
          enabled: false,
          period: 200,
          confirmation: false
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 0.5   // 极低波动要求
        },
        ichimoku: {
          enabled: false,
          tenkan: 9,
          kijun: 26,
          senkou: 52
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 0.8,  // 套利微小利润
          trailing: false,
          trailDistance: 0
        },
        stopLoss: {
          enabled: true,
          percentage: 0.4,  // 极严格止损
          dynamic: false,
          atrMultiplier: 0.5
        },
        rsi: {
          enabled: false,
          period: 14,
          overbought: 70,
          duration: 2
        },
        gravestone: {
          enabled: false,
          timeframe: '1h',
          shadowRatio: 2.5
        },
        macd: {
          enabled: false,
          divergence: false,
          bearishCross: false
        },
        bollinger: {
          enabled: false,
          upperBand: false,
          squeeze: false
        },
        volumeProfile: {
          enabled: true,
          resistance: false,
          lowVolume: true   // 流动性监控
        }
      }
    },
    riskConfig: {
      maxPosition: 95,      // 套利可满仓
      maxSingleTrade: 30,   // 大仓位快进快出
      riskFactor: 0.3,      // 极低风险
      dailyMaxLoss: 0.8,    // 严格日损控制
      maxConsecutiveLoss: 15, // 套利允许多次尝试
      drawdownAlert: 3,
      dailyMaxTrades: 100,  // 极高频
      tradeInterval: 1,     // 秒级间隔
      cooldownPeriod: 2,
      kellyRatio: 0.5,      // 高胜率高仓位
      sharpeThreshold: 3.0,
      correlationLimit: 0.95
    }
  },
  {
    id: 5,
    name: 'ADA波动率突破策略',
    type: 'volatility',
    symbol: 'ADA/USDT',
    status: 'stopped',
    totalReturn: 8.76,
    dailyReturn: 0.24,
    trades: 67,
    winRate: 55.2,
    drawdown: -18.5,
    initialCapital: 25000,
    currentCapital: 27190,
    createTime: '2024-02-05 16:30:00',
    updateTime: '2024-02-18 12:15:30',
    riskLevel: 'high',
    description: '基于ATR波动率指标的突破策略，适合ADA大幅波动行情',
    sharpeRatio: 0.86,
    maxRunup: 19.2,
    avgTradeReturn: 1.31,
    volatility: 24.7,
    indicators: {
      buy: {
        dragonfly: {
          enabled: false,
          timeframe: '1h',
          shadowRatio: 2.5
        },
        rsi: {
          enabled: true,
          period: 21,
          oversold: 20,     // 极端超卖
          confirm: 28
        },
        volume: {
          enabled: true,
          multiplier: 3.0,  // 爆量突破
          period: 14
        },
        ma: {
          enabled: true,
          short: 8,
          long: 21,
          position: 'breakout' // 突破均线
        },
        macd: {
          enabled: true,
          fast: 12,
          slow: 26,
          signal: 9         // MACD突破零轴
        },
        bollinger: {
          enabled: true,
          period: 20,
          stdDev: 2.5       // 布林带扩张
        },
        stochastic: {
          enabled: true,
          period: 14,
          smoothK: 5,
          smoothD: 3        // KDJ极值反转
        },
        ema: {
          enabled: false,
          period: 200,
          confirmation: false
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 2.5   // 高波动率确认
        },
        ichimoku: {
          enabled: true,
          tenkan: 9,
          kijun: 26,
          senkou: 52        // 一目均衡表突破
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 12.0, // 波动率策略高止盈
          trailing: true,
          trailDistance: 4.0
        },
        stopLoss: {
          enabled: true,
          percentage: 6.5,  // 较宽止损应对波动
          dynamic: true,
          atrMultiplier: 3.0 // ATR动态止损
        },
        rsi: {
          enabled: true,
          period: 21,
          overbought: 80,   // 极端超买
          duration: 2
        },
        gravestone: {
          enabled: true,
          timeframe: '1h',
          shadowRatio: 4.0  // 强反转信号
        },
        macd: {
          enabled: true,
          divergence: true,
          bearishCross: true
        },
        bollinger: {
          enabled: true,
          upperBand: true,
          squeeze: true     // 布林带收缩
        },
        volumeProfile: {
          enabled: true,
          resistance: true,
          lowVolume: true   // 量能衰竭
        }
      }
    },
    riskConfig: {
      maxPosition: 50,      // 波动率策略中等仓位
      maxSingleTrade: 25,
      riskFactor: 2.5,      // 高风险系数
      dailyMaxLoss: 8,      // 较高日损容忍
      maxConsecutiveLoss: 2, // 严格连损控制
      drawdownAlert: 20,
      dailyMaxTrades: 4,    // 低频精选
      tradeInterval: 90,    // 长间隔
      cooldownPeriod: 180,
      kellyRatio: 0.2,      // 保守的凯利公式
      sharpeThreshold: 0.8,
      correlationLimit: 0.6
    }
  },
  {
    id: 6,
    name: 'DOT均线多空策略',
    type: 'technical',
    symbol: 'DOT/USDT',
    status: 'running',
    totalReturn: 13.28,
    dailyReturn: 0.41,
    trades: 98,
    winRate: 64.3,
    drawdown: -9.7,
    initialCapital: 40000,
    currentCapital: 45312,
    createTime: '2024-01-30 10:45:00',
    updateTime: '2024-02-20 15:20:18',
    riskLevel: 'medium',
    description: '多重均线系统，结合斐波那契回调位，捕捉DOT中长线趋势',
    sharpeRatio: 1.52,
    maxRunup: 18.9,
    avgTradeReturn: 1.35,
    volatility: 14.2,
    indicators: {
      buy: {
        dragonfly: {
          enabled: false,
          timeframe: '4h',
          shadowRatio: 3.0
        },
        rsi: {
          enabled: true,
          period: 14,
          oversold: 28,
          confirm: 35
        },
        volume: {
          enabled: true,
          multiplier: 1.6,
          period: 21
        },
        ma: {
          enabled: true,
          short: 21,        // 斐波那契周期
          long: 55,
          position: 'multi_ma_align' // 多均线排列
        },
        macd: {
          enabled: true,
          fast: 12,
          slow: 26,
          signal: 9
        },
        bollinger: {
          enabled: true,
          period: 20,
          stdDev: 2.0
        },
        stochastic: {
          enabled: true,
          period: 14,
          smoothK: 3,
          smoothD: 3
        },
        ema: {
          enabled: true,
          period: 89,       // 斐波那契EMA
          confirmation: true
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 1.4
        },
        ichimoku: {
          enabled: true,
          tenkan: 9,
          kijun: 26,
          senkou: 52
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 7.8,
          trailing: true,
          trailDistance: 2.8
        },
        stopLoss: {
          enabled: true,
          percentage: 4.5,
          dynamic: true,
          atrMultiplier: 2.5
        },
        rsi: {
          enabled: true,
          period: 14,
          overbought: 72,
          duration: 2
        },
        gravestone: {
          enabled: false,
          timeframe: '4h',
          shadowRatio: 3.0
        },
        macd: {
          enabled: true,
          divergence: true,
          bearishCross: true
        },
        bollinger: {
          enabled: true,
          upperBand: true,
          squeeze: false
        },
        volumeProfile: {
          enabled: true,
          resistance: true,
          lowVolume: false
        }
      }
    },
    riskConfig: {
      maxPosition: 70,
      maxSingleTrade: 16,
      riskFactor: 1.1,
      dailyMaxLoss: 3.5,
      maxConsecutiveLoss: 4,
      drawdownAlert: 10,
      dailyMaxTrades: 8,
      tradeInterval: 35,
      cooldownPeriod: 50,
      kellyRatio: 0.28,
      sharpeThreshold: 1.4,
      correlationLimit: 0.7
    }
  },
  {
    id: 7,
    name: 'LINK RSI反转策略',
    type: 'technical',
    symbol: 'LINK/USDT',
    status: 'error',
    totalReturn: -2.15,
    dailyReturn: -0.18,
    trades: 45,
    winRate: 42.2,
    drawdown: -15.8,
    initialCapital: 20000,
    currentCapital: 19570,
    createTime: '2024-02-10 09:15:00',
    updateTime: '2024-02-20 11:45:30',
    riskLevel: 'high',
    description: 'RSI极值反转策略，适合LINK超跌反弹和超涨回调',
    sharpeRatio: -0.23,
    maxRunup: 8.5,
    avgTradeReturn: -0.48,
    volatility: 19.6,
    indicators: {
      buy: {
        dragonfly: {
          enabled: true,
          timeframe: '1h',
          shadowRatio: 4.5  // 极强反转信号
        },
        rsi: {
          enabled: true,
          period: 14,
          oversold: 15,     // 极端超卖
          confirm: 22
        },
        volume: {
          enabled: true,
          multiplier: 2.2,  // 确认放量
          period: 10
        },
        ma: {
          enabled: true,
          short: 10,
          long: 20,
          position: 'mean_reversion' // 均值回归
        },
        macd: {
          enabled: true,
          fast: 8,          // 更敏感的MACD
          slow: 21,
          signal: 5
        },
        bollinger: {
          enabled: true,
          period: 20,
          stdDev: 2.2
        },
        stochastic: {
          enabled: true,
          period: 14,
          smoothK: 3,
          smoothD: 3
        },
        ema: {
          enabled: false,
          period: 200,
          confirmation: false
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 1.8
        },
        ichimoku: {
          enabled: false,
          tenkan: 9,
          kijun: 26,
          senkou: 52
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 5.5,  // 反转策略快速获利
          trailing: false,
          trailDistance: 0
        },
        stopLoss: {
          enabled: true,
          percentage: 3.2,  // 严格控制风险
          dynamic: true,
          atrMultiplier: 1.8
        },
        rsi: {
          enabled: true,
          period: 14,
          overbought: 85,   // 极端超买
          duration: 1
        },
        gravestone: {
          enabled: true,
          timeframe: '1h',
          shadowRatio: 4.5
        },
        macd: {
          enabled: true,
          divergence: true,
          bearishCross: true
        },
        bollinger: {
          enabled: true,
          upperBand: true,
          squeeze: false
        },
        volumeProfile: {
          enabled: true,
          resistance: true,
          lowVolume: true
        }
      }
    },
    riskConfig: {
      maxPosition: 40,      // 反转策略小仓位
      maxSingleTrade: 20,
      riskFactor: 2.0,
      dailyMaxLoss: 5,
      maxConsecutiveLoss: 2, // 严格连损控制
      drawdownAlert: 15,
      dailyMaxTrades: 6,
      tradeInterval: 60,
      cooldownPeriod: 120,
      kellyRatio: 0.15,     // 低胜率保守管理
      sharpeThreshold: 0.5,
      correlationLimit: 0.5
    }
  },
  {
    id: 8,
    name: 'MATIC网格加仓策略',
    type: 'grid',
    symbol: 'MATIC/USDT',
    status: 'running',
    totalReturn: 21.56,
    dailyReturn: 0.68,
    trades: 189,
    winRate: 75.1,
    drawdown: -7.3,
    initialCapital: 35000,
    currentCapital: 42546,
    createTime: '2024-01-28 13:30:00',
    updateTime: '2024-02-20 17:10:15',
    riskLevel: 'medium',
    description: '动态网格策略配合DCA加仓，适合MATIC长期持有',
    sharpeRatio: 2.01,
    maxRunup: 24.8,
    avgTradeReturn: 1.14,
    volatility: 11.4,
    indicators: {
      buy: {
        dragonfly: {
          enabled: false,
          timeframe: '2h',
          shadowRatio: 2.8
        },
        rsi: {
          enabled: true,
          period: 14,
          oversold: 38,     // DCA策略较温和
          confirm: 45
        },
        volume: {
          enabled: true,
          multiplier: 1.2,  // 温和成交量
          period: 18
        },
        ma: {
          enabled: true,
          short: 15,
          long: 35,
          position: 'dca_zone' // DCA加仓区域
        },
        macd: {
          enabled: false,
          fast: 12,
          slow: 26,
          signal: 9
        },
        bollinger: {
          enabled: true,
          period: 20,
          stdDev: 1.9       // 布林带中下轨
        },
        stochastic: {
          enabled: true,
          period: 14,
          smoothK: 3,
          smoothD: 3
        },
        ema: {
          enabled: true,
          period: 100,      // 长期趋势确认
          confirmation: true
        },
        atr: {
          enabled: true,
          period: 14,
          multiplier: 1.0
        },
        ichimoku: {
          enabled: false,
          tenkan: 9,
          kijun: 26,
          senkou: 52
        }
      },
      sell: {
        takeProfit: {
          enabled: true,
          percentage: 3.8,  // 网格分批获利
          trailing: false,
          trailDistance: 0
        },
        stopLoss: {
          enabled: true,
          percentage: 2.5,  // 较宽止损
          dynamic: false,
          atrMultiplier: 1.5
        },
        rsi: {
          enabled: true,
          period: 14,
          overbought: 62,   // 早期获利
          duration: 2
        },
        gravestone: {
          enabled: false,
          timeframe: '2h',
          shadowRatio: 2.8
        },
        macd: {
          enabled: false,
          divergence: false,
          bearishCross: false
        },
        bollinger: {
          enabled: true,
          upperBand: true,
          squeeze: false
        },
        volumeProfile: {
          enabled: false,
          resistance: false,
          lowVolume: false
        }
      }
    },
    riskConfig: {
      maxPosition: 85,
      maxSingleTrade: 10,   // DCA小额分批
      riskFactor: 0.8,
      dailyMaxLoss: 2.5,
      maxConsecutiveLoss: 6,
      drawdownAlert: 8,
      dailyMaxTrades: 20,
      tradeInterval: 12,
      cooldownPeriod: 20,
      kellyRatio: 0.25,
      sharpeThreshold: 1.8,
      correlationLimit: 0.75
    }
  }
];

// 模拟API延迟
export const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

// 模拟获取策略列表API
export const getStrategies = async (): Promise<Strategy[]> => {
  await delay(1000); // 模拟网络延迟
  return mockStrategies;
};

// 模拟获取单个策略详情API
export const getStrategyById = async (id: number): Promise<Strategy | null> => {
  await delay(800);
  return mockStrategies.find(strategy => strategy.id === id) || null;
};

// 模拟更新策略API
export const updateStrategy = async (id: number, data: Partial<Strategy>): Promise<Strategy> => {
  await delay(1200);
  const strategyIndex = mockStrategies.findIndex(s => s.id === id);
  if (strategyIndex !== -1) {
    mockStrategies[strategyIndex] = { ...mockStrategies[strategyIndex], ...data };
    mockStrategies[strategyIndex].updateTime = new Date().toLocaleString('zh-CN');
    return mockStrategies[strategyIndex];
  }
  throw new Error('策略不存在');
};

// 模拟创建策略API
export const createStrategy = async (data: Omit<Strategy, 'id' | 'createTime' | 'updateTime'>): Promise<Strategy> => {
  await delay(1500);
  const newStrategy: Strategy = {
    ...data,
    id: Math.max(...mockStrategies.map(s => s.id)) + 1,
    createTime: new Date().toLocaleString('zh-CN'),
    updateTime: new Date().toLocaleString('zh-CN')
  };
  mockStrategies.push(newStrategy);
  return newStrategy;
};

// 模拟删除策略API
export const deleteStrategy = async (id: number): Promise<boolean> => {
  await delay(800);
  const index = mockStrategies.findIndex(s => s.id === id);
  if (index !== -1) {
    mockStrategies.splice(index, 1);
    return true;
  }
  return false;
}; 